#encoding:utf-8
from celery import Celery
import time

# 配置 broker、backend
celery = Celery('tasks',broker="redis://127.0.0.1:6379/0",backend="redis://127.0.0.1:6379/0")

# 设定任务
@celery.task
def send_msg():
    print("邮件开始发送.....",time.time())
    time.sleep(5)
    print("邮件发送结束.....",time.time())

# 切换到当前路径的命令行 执行 celery -A tasks(是文件名) --pool=eventlet --loglevel=info